< previous page page_330 next page >

Page 330
Continued
Listing 14.4
    Select Case mCharAccept
        Case 0 'Any character is acceptable
            Exit Sub
        Case 1 'Only numbers may be entered
            If KeyAscii >= 48 And KeyAscii <= 57 Then
                Exit Sub
            Else
                KeyAscii = 0
                Beep
                RaiseEvent UserError
            End If
        Case 2 'Only letters may be entered
            If KeyAscii >= 65 And KeyAscii <= 90 Then
                Exit Sub
            ElseIf KeyAscii >= 97 And KeyAscii <= 122 Then
                Exit Sub
            Else
                KeyAscii = 0
                Beep
                RaiseEvent UserError
            End If
    End Select

End Sub
Adding the custom code is necessary because the wizard creates a only "skeleton" for these items. After all, if the wizard could do everything, then you would be out of a job!
Using the Property Pages Wizard
You have seen Property Pages used for some of the controls that come with Visual Basic. These dialog boxes make it easy for you to set the properties of a control by organizing them into groups. You can create Property Pages for your own custom controls by using the Property Pages Wizard. As with the ActiveX Control Interface Wizard, you have to add the Property Pages Wizard to the desktop through the use of the Add-In Manager. After you take this step, you can access the Property Pages Wizard from the Add-Ins menu of Visual Basic. Upon starting the Property Pages Wizard, you see an introductory screen that explains the purpose of the wizard. Clicking the Next button on this page takes you to the first dialog box, where the real work is done.
Creating the Pages
The Select the Property Pages dialog box lets you define the pages of the Property Pages dialog box (see Figure 14.15). If you have included Font and Color properties in your control, the wizard starts with two default pages: StandardColor and StandardFont. If you do not need these pages, just click the boxes next to the names to remove them from the Property Pages.

 
< previous page page_330 next page >